import time


def log(*args, **kwargs):
    '''
    用于代替 print， 提供格式化的关键信息输出
    提供统一的 print 开关管理，避免服务器in/output 错误
    :param args:
    :param kwargs:
    输出log日志
    '''
    time_format = '%Y/%m/%d %H:%M:%S'
    localtime = time.localtime(int(time.time()))
    formatted = time.strftime(time_format, localtime)
    with open('log.huawei.log', 'a', encoding='utf-8') as f:
        print(formatted, *args, **kwargs)
        print(formatted, *args, file=f, **kwargs)

def log_out(*args, **kwargs):
    '''
    用于代替 print， 提供格式化的关键信息输出
    提供统一的 print 开关管理，避免服务器in/output 错误
    :param args:
    :param kwargs:
    输出log日志
    '''
    time_format = '%Y/%m/%d %H:%M:%S'
    localtime = time.localtime(int(time.time()))
    formatted = time.strftime(time_format, localtime)
    with open('log.huawei.json', 'a', encoding='utf-8') as f:
        # print(formatted, *args, **kwargs)
        print(formatted, *args, file=f, **kwargs)
